<script>
function call_playitem(num){
	thisMovie("flashplayer").play_track(num);
}
function call_play(){
	thisMovie("flashplayer").play_track();
}
function call_pause(){
	thisMovie("flashplayer").pause_track();
}
function call_stop(){
	thisMovie("flashplayer").stop_track();
}
function call_prev(){
	thisMovie("flashplayer").previous_track();
}
function call_next(){
	thisMovie("flashplayer").next_track();
}

function ytQualityAvai(avai){
	var sp = avai.split(",");
	if(sp=="null"){
		document.getElementById("ytq").innerHTML = "";
		return;
	}
	sp = sp.length;
	var sel = 'Youtube Quality : <select id="selytq" onchange="select_ytQuality();">';
	if(sp>=2){
		sel += '<option value="meidum">360p</option>'
		sel += '<option value="large">480p</option>'
	}
	if(sp>=3){
		sel += '<option value="hd720">720p</option>'
	}
	if(sp>=4){
		sel += '<option value="hd1080">1080p</option>'
	}
	sel += '</select>'
	if(sp>=2){
		document.getElementById("ytq").innerHTML = sel;
	}
}
function select_ytQuality(){
	thisMovie("flashplayer").quality_youtube(document.getElementById("selytq").value);
}

function update_time(){
	var curTime = thisMovie("flashplayer").current_time();
	if(curTime==null || curTime<0){curTime = 0}
	var hour = Math.floor(curTime/3600);
	var min = Math.floor((curTime-hour*3600)/60);
	var sec = Math.floor(curTime-hour*3600-min*60);
	if(hour==0){
		hour = ""
	}else{
		if(hour<10){
			hour = "0"+hour;
		}
		hour += ":";
	}
	if(min<10){min = "0"+min}
	if(sec<10){sec = "0"+sec}
	curTime = hour+min+":"+sec;
	
	var totalTime = thisMovie("flashplayer").total_time();
	if(totalTime==null || totalTime<0){totalTime = 0}
	var hour = Math.floor(totalTime/3600);
	var min = Math.floor((totalTime-hour*3600)/60);
	var sec = Math.floor(totalTime-hour*3600-min*60);
	if(hour==0){
		hour = ""
	}else{
		if(hour<10){
			hour = "0"+hour;
		}
		hour += ":";
	}
	if(min<10){min = "0"+min}
	if(sec<10){sec = "0"+sec}
	totalTime = hour+min+":"+sec;
	
	document.getElementById("itime").innerHTML = "Time: "+curTime+"/"+totalTime;
}
function update_byte(){
	var curByte = thisMovie("flashplayer").current_byte();
	if(curByte==null || curByte<0){curByte = 0}
	curByte = curByte/1024/1024*100;
	curByte = Math.floor(curByte)/100;
	
	var totalByte = thisMovie("flashplayer").total_byte();
	if(totalByte==null || totalByte<0){totalByte = 0}
	totalByte = totalByte/1024/1024*100;
	totalByte = Math.floor(totalByte)/100;
	
	document.getElementById("ibyte").innerHTML = "Byte: "+curByte+"/"+totalByte+" MB";
}
function update_idtrack(){
	var curTrack = thisMovie("flashplayer").current_track()+1;
	var totalTrack = thisMovie("flashplayer").total_track();
	
	document.getElementById("info_track").innerHTML = "List: "+curTrack+"/"+totalTrack;
}

setInterval(update_time,10);
setInterval(update_byte,10);
setInterval(update_idtrack,100);

function thisMovie(movieName) {
	if (navigator.appName.indexOf("Microsoft") != -1) {
		return window[movieName];
	}
	else{
		return document[movieName];
	}
}
</script>
<object id="flashplayer" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="400" height="330">
<param name="movie" value="mediaplayer.swf" />
<param name="allowFullScreen" value="true" />
<param name="allowScriptAccess" value="always" />
<param name="bgcolor" value="#FFFFFF" />
<param name="FlashVars" value="file=playlist.xml&" />
<embed name="flashplayer" src="mediaplayer.swf" FlashVars="file=playlist.xml&" bgcolor="#FFFFFF" type="application/x-shockwave-flash" allowfullscreen="true" allowScriptAccess="always" width="400" height="330" />
</object>
<br/>

<div id="itime">Time:</div>
<div id="ibyte">Byte:</div>
<div id="info_track">List:</div>
<div id="ytq"></div>

<li><a href="javascript:void()" onclick="call_playitem(0);">Iron man 2</a></li>
<li><a href="javascript:void()" onclick="call_playitem(1);">Tron Legacy</a></li>
<li><a href="javascript:void()" onclick="call_playitem(2);">Mortal Kombat 9</a></li>

<br/>
<form>
<input type="button" onclick="call_play()" value="Play" />
<input type="button" onclick="call_pause()" value="Pause" />
<input type="button" onclick="call_stop()" value="Stop" />
<input type="button" onclick="call_prev()" value="Previous" />
<input type="button" onclick="call_next()" value="Next" />
</form>
